<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>FCKeditor - Sample</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="robots" content="noindex, nofollow" />
  <script src="/javascripts/prototype.js?1189122238" type="text/javascript"></script>
  <link href="/stylesheets/style.css?1196424131" media="screen" rel="Stylesheet" type="text/css" />
 <script type="text/javascript" src="/fckeditor/fckeditor.js"></script>
<script>
   function setValue() {
      document.getElementById("wiki_content").value = window.parent.document.getElementById("wiki_content").value;
 }  
function GetContents(){
   var oEditor = FCKeditorAPI.GetInstance('wiki_content');
   alert(oEditor);
}
</script>
</head>
<body style="margin:0;padding:0;background:#f0f0f0" onload="parent.document.getElementById('loading').style.display='none';Element.show('wiki_content')">
<div id=loading style="text-align:right;position:absolute;right:0px;margin-top:0px;height:21px;font-weight:bold;background:red;color:white;display:none;z-index:1000;">
  <%=image_tag"loading.gif"%><%="Saving writeboard, please wait...".t%>
</div>
<div id=wiki_content style="display:none">
<%form_for(:wiki, :url =>{:action=>'save_wiki'}) do |f| %>
    <%=f.hidden_field :user_id,:value=>@cur_user.id%>
    <%=f.hidden_field :writeboard_id,:value=>@writeboard.id%>
    <%=hidden_field_tag :project_id,@writeboard.project_id%>
    <%=hidden_field_tag "wiki_content",(@wiki ? @wiki.content : @writeboard.wikis.first.content)%> 
    <div name='button' style="margin:2px;width:95%;border:0px red dashed;text-align:left">
     <span class=float_right>
     <%=submit_tag"Save".t,:class=>'button',:onclick=>"Element.show('loading')"%>
    <input type="button" class="button" value='<%="View".t%>' onclick="window.parent.document.location.href='<%=writeboard_path(@writeboard.project,@writeboard)%>'">
    <input type="button" class="button" value='<%="Back".t%>' onclick="window.parent.document.location.href='<%=writeboards_path(@writeboard.project)%>'">
     </span>
     <select class="button" onchange="document.location.href='/projects/<%=@writeboard.project_id%>/writeboards;wiki?wrid=<%=@writeboard.id%>&wiid=' + this.options[this.selectedIndex].value";>
       <%@writeboard.wikis.each do |w|%>
       <option value="<%=w.id%>" 
        <%=" selected" if params[:wiid].to_i == w.id%>
        ><%=w.created_at.strftime('%Y-%m-%d %H:%M') + " - by " + w.user.name%></option>
       <%end%>
     </select>
     <strong><%="Category".t%>:</strong>
     <span id='cat_show'>
      <%=render :partial=>'categories/cat_show',:locals=>{:cats=>@cats,:cur_cat=>@writeboard.category_id,:label=>'writeboards'}%>
     </span>
    </div>
<div style="text-align:left;width:90%;margin-left:10px;margin-right:0px;">
<script type="text/javascript">
oFCKeditor = new FCKeditor( 'wiki_content' );
oFCKeditor.BasePath  = "/fckeditor/";
oFCKeditor.Height = screen.height * 0.48;
oFCKeditor.Width = screen.width * 0.60;
oFCKeditor.Config['CustomConfigurationsPath'] = '/javascripts/fckconfig_simple.js';
//oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:parent(xToolbar)';
oFCKeditor.ToolbarSet = 'WIKI';
oFCKeditor.Value = '';
oFCKeditor.Create();
</script>
</div>
<%end%>
</div>
</body>
</html>
